﻿@model MvcCms.Store.Web.ViewModels.DefaultViewModel

@foreach (var order in Model._Orders)
{    
    var orderDetails = order.OrderDetails;
    <table>
    <tr>
        <th colspan="3">
        Order Number: @order.OrderID
        </th>
    </tr>
    <tr>
        <th>
            Product
        </th>
        <th>
            Quantity
        </th>
        <th>
            UnitPrice
        </th>
    </tr>
    @foreach (var orderDetail in orderDetails)
    {
        <tr>
            <td>
        @if (orderDetail.PriceOptionID.HasValue && orderDetail.PriceOption.RequiresNotes)
        {
            @orderDetail.PriceOption.Title
        }
        else
        {
            @orderDetail.Product.Title
        }
            </td>
            <td>
                @orderDetail.Quantity
            </td>
            <td>
                @String.Format("{0:F}", orderDetail.UnitPrice)
            </td>
        </tr>
    }
    <tr>
        <td>
        Total:
        </td>
        <td></td>
        <td>
            @String.Format("{0:F}", order.Total)
        </td>
    </tr>
    @if (!string.IsNullOrEmpty(order.OrderNotes))
    {
    <tr>
        <td colspan="3">
            <div class="orderNotes">
                @Html.Raw(order.OrderNotes)
            </div>        
        </td>
    </tr>
    }
</table>
<br /><br />    
}